﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>流程抄送列表</title>
    <link href="Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="Scripts/bootstrap/css/font-awesome.css" rel="stylesheet">
    <link href="Style/skin/css/style.css" rel="stylesheet" type="text/css" />
    <link href="Style/skin/css/animate.css" rel="stylesheet" type="text/css" />
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="ibox-content">
            <table id="Table1" class="table table-striped">
                <thead>
                    <tr>
                        <th>
                            #
                        </th>
                        <th>
                            流程
                        </th>
                        <th>
                            节点
                        </th>
                        <th>
                            状态
                        </th>
                        <th>
                            抄送人
                        </th>
                        <th>
                            标题
                        </th>
                        <th>
                            内容
                        </th>
                        <th>
                            日期
                        </th>
                        <th>
                            操作
                        </th>
                    </tr>
                </thead>
                <tbody id="Rows"></tbody>
            </table>
        </div>
    </div>
    <script type="text/javascript" src="./Scripts/bootstrap/js/jquery.min.js"></script>
    <script type="text/javascript" src="./Scripts/bootstrap/js/bootstrap.min.js"></script>
    <script src="./Scripts/QueryString.js" type="text/javascript"></script>
    <script src="./Scripts/config.js" type="text/javascript"></script>
    <script src="Comm/Gener.js" type="text/javascript"></script>
    <script src="Style/skin/layui/layer.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        //打开默认窗口
        function WinOpenFull(url) {
            layer.open({
                skin: 'layer-class',
                type: 2,
                title: '抄送',
                area: ['96%', '90%'],
                content: url
            });
        }
        //页面启动函数.
        $(function () {

            var handler = new HttpHandler("BP.WF.HttpHandler.WF");
            handler.AddUrlData();
            var data = handler.DoMethodReturnString("CC_Init");

            if (data.indexOf('err@') == 0) {
                alert(data);
                return;
            }

            //转换.
            data = JSON.parse(data);
            var row = "";
            for (var i = 0; i < data.length; i++) {

                var dt = data[i];

                var batchUrl = "";
                var url = "";

                batchUrl = './WFRpt.htm?FK_Flow=' + dt.FK_Flow + '&FK_Node=' + dt.FK_Node + '&WorkID=' + dt.WorkID + '&FID=' + dt.FID + "&CCSta=1";
                url = '../WF/WorkOpt/CCCheckNote.htm?WorkID=' + dt.WorkID + '&FK_Flow=' + dt.FK_Flow + '&FID=0&FK_Node=' + dt.FK_Node;

                row += "<tr>";
                row += "<td>" + i + "</td>";
                row += "<td>" + dt.FlowName + "</td>";
                row += "<td>" + dt.NodeName + "</td>";

                var sta = "";
                switch (dt.WFSta) {
                    case 0:
                        sta = "<font color=green>运行中</font>";
                        break;
                    case 1:
                        sta = "已完成"
                        break;
                    default:
                        sta = "其他";
                        break;
                }

                row += "<td>" + sta + "</td>";
                row += "<td>" + dt.Rec + "</td>";
                row += "<td><a    href=\"javascript:OpenFrm('" + dt.FK_Flow + "','" + dt.FK_Node + "','" + dt.WorkID + "','" + dt.FID + "','" + dt.Sta + "')\" >" + dt.Title + "</a></td>";
                row += "<td>" + dt.Doc + "</td>";
                row += "<td>" + dt.RDT + "</td>";

                row += "<td>";
                row += "<a href=\"javascript:OpenTrack('" + dt.FK_Flow + "','" + dt.FK_Node + "','" + dt.WorkID + "','" + dt.FID + "','" + dt.CCSta + "')\" >轨迹</a>";
                row += "</td>";

                row += "</tr>";
            }
            $("#Rows").html(row);
            return;
        });

         /* 打开表单. */
        function OpenFrm(flowNo, nodeID, workid, fid,sta) {

            var currNodeId = nodeID;

            //但前节点所处的位置
            var nowNode = new Entity("BP.WF.Node", nodeID);

            //如果是树形表单，则显示当前人所处节点的数据
            if (nowNode.FormType == 5) {
                //获取人员所处的流程节点

                var currNode = new Entity("BP.WF.Node", currNodeId);
                if (currNode.HisToNDs.indexOf(nodeID) == -1) {
                    if ((currNode.RunModel == RunModel.HL || currNode.RunModel == RunModel.FHL || currNode.RunModel == RunModel.FL) && (fid != 0)) {
                        workID = fid;
                        fid = 0;
                        nodeID = currNodeId;
                    }
                } else {
                    //判断当前节点的运行模式
                    if ((currNode.RunModel == RunModel.HL || currNode.RunModel == RunModel.FHL || currNode.RunModel == RunModel.FL) && nowNode.RunModel == RunModel.SubThread) {
                        workID = fid;
                        fid = 0;
                        nodeID = currNodeId;
                    } else if (currNode.RunModel == RunModel.SubThread) {
                        nodeID = currNodeId;
                    }
                }


            }

            window.open("./MyCC.htm?WorkID="+workid+"&FK_Node="+nodeID+"&FK_Flow="+flowNo+"&FID="+fid+"&CCSta=1");

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt_OneWork");
            handler.AddUrlData();
            handler.AddPara("FromWorkOpt", "1");
            handler.AddPara("WorkID", workid);
            handler.AddPara("FK_Node", nodeID);
            handler.AddPara("FK_Flow", flowNo);
            handler.AddPara("CCSta", "1");
            handler.AddPara("FID", fid);
            var data = handler.DoMethodReturnString("Runing_OpenFrm");

            if (data.indexOf('err@') == 0) {
                alert(data);
                return;
            }

            //SDK表单或者是嵌入式表单
            if (data.indexOf('urlForm@') == 0) {
                data = data.replace('urlForm@', '');
                if (data.indexOf("http") == -1)
                    data = basePath + data;
                if (data.indexOf('FromWorkOpt') == -1)
                    data = data + "&FromWorkOpt=1";

                window.open(data);
                return;
            }
            //自由/傻瓜/树形表单
            if (data.indexOf('url@') == 0) {
                data = data.replace('url@', '');

                if (data.indexOf('FromWorkOpt') == -1)
                    data = data + "&FromWorkOpt=1";

                window.open(data);
                return;
            }

            alert(data);
        }

        //打开轨迹
        function OpenTrack(flowNo,nodeID, workID, fid, ccSta) {

            var batchUrl = './WFRpt.htm?FK_Flow=' + flowNo + '&FK_Node=' + nodeID + '&WorkID=' + workID + '&FID=' + fid + "&CCSta=1";

            WinOpenFull(batchUrl);
        }
    </script>
</body>
</html>
